package com.concise.appapi.controller;

import com.concise.appapi.service.PigeonholeService;
import com.initialize.pub.pojo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * User: jane
 * Date: 2020/2/23
 * Time: 3:38 下午
 * Description: 归档控制器
 * @author jane
 */
@Api(tags = "归档API")
@CrossOrigin
@RestController
@RequestMapping(value = "/pigeonhole")
public class PigeonholeController {
    final
    PigeonholeService pigeonholeService;

    public PigeonholeController(PigeonholeService pigeonholeService) {
        this.pigeonholeService = pigeonholeService;
    }

    @ApiOperation(value = "获取归档文章的数量")
    @GetMapping("number_of_articles")
    public int getTheNumberOfArticles() {
        return pigeonholeService.getTheNumberOfArticles();
    }

    @ApiOperation(value = "获取列表")
    @GetMapping("list")
    public Result getList() {
        return Result.success(pigeonholeService.getList());
    }
}
